import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import HomeView from "@/views/HomeView.vue";
import RouteView from "@/views/RouteView.vue";
import serverRigisterPage from "@/views/supperManagement/config/serverRigister/index.vue";
import userConfig from "@/views/supperManagement/config/userConfig/index.vue";
// liuzhikun 新增 渠道平台配置 页面
import pmTransChannel from "@/views/pmManagement/pmTransChannel/index.vue"; // 渠道平台配置 页面
import pmAccBankDeadline from "@/views/pmManagement/pmAccBankDeadline/index.vue"; // 基础账户行截止时间配置 页面
import pmCurrency from "@/views/pmManagement/pmCurrency/index.vue"; // 币种配置 页面
import pmHolidayDescription from "@/views/pmManagement/pmHolidayDescription/index.vue"; // 节假日描述信息配置 页面
import pmPriority from "@/views/pmManagement/pmPriority/index.vue"; // 优先级管理配置 页面
import pmMsgTemplate from "@/views/pmManagement/pmMsgTemplate/index.vue"; // 交易报文模板配置 页面
import pmElementDef from "@/views/pmManagement/pmElementDef/index.vue"; // 交易报文要素定义配置 页面
import PmElementType from "@/views/pmManagement/PmElementType/index.vue"; // 要素类型配置 页面
import sysDictType from "@/views/systemManagement/sysDictType/index.vue"; // 字典管理 页面
import sysDictData from "@/views/systemManagement/sysDictData/index.vue"; // 字典数据管理 页面

import bmTransLogRecord from "@/views/bmManagement/bmTransLogRecord/bmTransLogRecord.vue"; // 交易日志信息管理 页面

// chenbaijun 新增 配置 页面
import pmChooseGroup from "@/views/pmManagement/pmChooseGroup/index.vue"; // 交易报文选择组配置 页面
import pmUniqueValidation from "@/views/pmManagement/pmUniqueValidation/index.vue"; // 交易唯一性判断模板配置 页面
import pmUniqueElement from "@/views/pmManagement/pmUniqueElement/index.vue"; // 交易唯一性判断要素配置 页面
import pmChooseOption from "@/views/pmManagement/pmChooseOption/index.vue"; // 交易报文选择项配置 页面
import pmConfirmDeadline from "@/views/pmManagement/pmConfirmDeadline/index.vue"; // 确认截止时间配置 页面
import pmClearingDeadline from "@/views/pmManagement/pmClearingDeadline/index.vue"; // 清结算截止时间配置 页面
import pmPollingRole from "@/views/pmManagement/pmPollingRole/index.vue"; // 轮询规则配置 页面
import pmMonitorProduct from "@/views/pmManagement/pmMonitorProduct/index.vue"; // 监控产品管理 页面
import appSettings from "@/config/defaultSettings";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "start",
    redirect: "/home"
  },
  // 一级菜单示范样例
  {
    path: "/user",
    name: "user",
    component: userConfig,
  },

  // 渠道平台配置作为一级菜单
  {
    path: "/home",
    name: "home",
    component: pmTransChannel,
  },
  // 配置管理页面进行二级菜单配置
  {
    path: "/pmManagement",
    name: "pmManagement",
    component: RouteView,
    redirect: "/pmManagement/pmTransChannel",
    children: [
      // 渠道平台配置
      {
        path: "/pmManagement/pmTransChannel",
        name: "pmTransChannel",
        component: pmTransChannel,
      },
      // 基础账户行截止时间配置
      {
        path: "/pmManagement/pmAccBankDeadline",
        name: "pmAccBankDeadline",
        component: pmAccBankDeadline,
      },
      // 币种配置
      {
        path: "/pmManagement/pmCurrency",
        name: "pmCurrency",
        component: pmCurrency,
      },
      // 节假日描述信息配置
      {
        path: "/pmManagement/pmHolidayDescription",
        name: "pmHolidayDescription",
        component: pmHolidayDescription,
      },
      // 优先级管理配置
      {
        path: "/pmManagement/pmPriority",
        name: "pmPriority",
        component: pmPriority,
      },
      // 交易报文模板配置
      {
        path: "/pmManagement/pmMsgTemplate",
        name: "pmMsgTemplate",
        component: pmMsgTemplate,
      },
      // 交易报文要素定义配置
      {
        path: "/pmManagement/pmElementDef",
        name: "pmElementDef",
        component: pmElementDef,
      },
      // 要素类型配置
      {
        path: "/pmManagement/PmElementType",
        name: "PmElementType",
        component: PmElementType,
      },
      // 交易报文选择组配置
      {
        path: "/pmManagement/pmChooseGroup",
        name: "pmChooseGroup",
        component: pmChooseGroup,
      },
      // 交易唯一性判断模板配置
      {
        path: "/pmManagement/pmUniqueValidation",
        name: "pmUniqueValidation",
        component: pmUniqueValidation,
      },
      // 交易唯一性判断要素配置
      {
        path: "/pmManagement/pmUniqueElement",
        name: "pmUniqueElement",
        component: pmUniqueElement,
      },
      // 交易报文选择项配置
      {
        path: "/pmManagement/pmChooseOption",
        name: "pmChooseOption",
        component: pmChooseOption,
      },
      // 确认截止时间配置
      {
        path: "/pmManagement/pmConfirmDeadline",
        name: "pmConfirmDeadline",
        component: pmConfirmDeadline,
      },
      // 清结算截止时间配置
      {
        path: "/pmManagement/pmClearingDeadline",
        name: "pmClearingDeadline",
        component: pmClearingDeadline,
      },
      // 轮询规则配置
      {
        path: "/pmManagement/pmPollingRole",
        name: "pmPollingRole",
        component: pmPollingRole,
      },   
      // 监控产品管理
      {
        path: "/pmManagement/pmMonitorProduct",
        name: "pmMonitorProduct",
        component: pmMonitorProduct,
      },           
    ],
  },

  // 配置管理页面进行二级菜单配置
  {
    path: "/systemManagement",
    name: "systemManagement",
    component: RouteView,
    redirect: "/systemManagement/sysDictType",
    children: [
      // 字典配置
      {
        path: "/systemManagement/sysDictType",
        name: "sysDictType",
        component: sysDictType,
      },  
      // 字典管理配置
      {
        path: "/systemManagement/sysDictData",
        name: "sysDictData",
        component: sysDictData,
      },        
    ],
  }, 
  
  // 配置管理页面进行二级菜单配置
  {
    path: "/bmManagement",
    name: "bmManagement",
    component: RouteView,
    redirect: "/bmManagement/bmTransLogRecord",
    children: [
      // 交易日志信息管理 配置
      {
        path: "/bmManagement/bmTransLogRecord",
        name: "bmTransLogRecord",
        component: bmTransLogRecord,
      },         
    ],
  },
];

const router = createRouter({
  history: createWebHistory(
   (window as any).__POWERED_BY_DUBHE__
    ? appSettings.dubhePrefix
    : process.env.BASE_URL
  ),
  routes,
 });
 
 export default router;